package com.equipment_management_p2.controller;


import com.equipment_management_p2.service.IEquipmentService;

import com.pojo.Entity.EquipmentRental;
import com.pojo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/eqm")
public class EquipmentController extends BaseController{
    @Autowired
    public IEquipmentService equipmentService;
    @RequestMapping(value = "rental/{uID}/{eSum}/{eID}")
    public Result<EquipmentRental> rental(@PathVariable Integer eID, @PathVariable Integer eSum,
                                          @PathVariable Integer uID){
        int count=equipmentService.modifyQuantity(eID,eSum,uID);
        return  count>0?Result.success():Result.failure();
    }

}
